<?php

	/**
	 * @see Bike_Js_VarPart
	 */
	require_once 'Bike/Js/VarPart.php';
	
	
	class Bike_Js_VarPart_Setting extends Bike_Js_VarPart
	{
        protected $_offset;
        protected $_offsetStr;

		public function getOffset()
		{			return (array) $this->_offset;
		}

		public function addOffset($Offset)
		{			if(is_null($this->_offset))
			{				$this->_offset = array();
			}
			array_push($this->_offset, $Offset);
			return $this;
		}

		public function _offset($Offset)
		{			return $this->addOffset($Offset);
		}
		
		protected function getOffsetStrPart()
		{
			if(is_null($this->_offsetStr))
			{
				$offset = array();
				foreach($this->getOffset() as $item)
				{
					array_push($offset, $this->_prepareValue($item));
				}
				$this->_offsetStr = sizeof($offset) ? '['.join('][', $offset).']' : '';
			}
			return $this->_offsetStr;
		}
		
		public function getVarCaching()
		{
			return True;
		}
		
		public function _toString()
		{
			return parent::_toString().$this->getOffsetStrPart();
		}
	}
